<?php
/**
 * Created by PhpStorm.
 * User:ly
 * Date: 2018\1\18 0018
 * Time: 16:57
 */
use yii\helpers\Url;
//use common\models\UserModel;
//$userModel = new UserModel();
$mortgageType=Yii::$app->params['mortgageTypes'];
//$mortgageTypes3=Yii::$app->params['mortgageTypes3'];//抵押物类型（抵押表）
$chineseNumber = [
    0 => '一', 1 => '二', 2 => '三', 3 => '四', 4 => '五',
    5 => '六', 6 => '七',7 => '八', 8 => '九', 9=> '十',
    10 => '十一', 11 => '十二', 12 => '十三', 13 => '十四', 14 => '十五',
    15 => '十六', 16 => '十七', 17 => '十八', 18 => '十九', 19 => '二十'
];
?>
<html xmlns:o="urn:schemas-microsoft-com:office:office"
      xmlns:w="urn:schemas-microsoft-com:office:word"
      xmlns="http://www.w3.org/TR/REC-html40"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <xml>
        <w:WordDocument>
            <w:View>Print</w:View>
    </xml>
    <style>
        body {font-family: 微软雅黑;}
        .bg {background-color: #c7d9f0}
        table tr td {word-break: break-all;font-size: 14px;line-height: 30px;padding: 5px;}
        tr{height: 40px;}
        .th_width {width: 70px;word-break: break-all;}
        .red_font {color: red;}
    </style>
</head>
<h1 style="text-align: center;padding-bottom: 20px;border-bottom: 1px solid #E2E8FF;margin-top: 150px;font-size:36px">
尽调评估报告</h1>
<h2 style="text-align: center;font-size:22px"><?php echo $data['title'];?>项目</h2>
<span lang=EN-US style="font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:"
      mce_style="font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:" Times New Roman';mso-fareast-font-family:宋体;mso-font-kerning:1.0pt;mso-ansi-language
EN-US;mso-fareast-language:ZH-CN;mso-bidi-language:AR-SA'>
<br clear=all style="page-break-before:always" mce_style="page-break-before:always">
</span>
<h3 style="text-align: center;">尽调评估报告</h3>
<h4>一、债权基本情况</h4>
<table border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;"  width="100%">
    <tr>
        <td class="bg th_width red_font">借款人名称</td>
        <td width="35%"><?php echo $data['investigation']?$data['investigation']['borrower']:'';?></td>
        <td class="bg th_width  red_font">保证人名称</td>
        <td width="35%"><?php echo $data['investigation']?$data['investigation']['guarantor']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width red_font">抵押人名称</td>
        <td><?php echo $data['investigation']?$data['investigation']['mortgagor']:'';?></td>
        <td class="bg th_width red_font">抵押物类型</td>
        <?php
        //获取抵押物类型名称-开始
        $mortgage_type_str='';//抵押物类型名称（抵押查封中）
        if($data['investigation'] && !empty($data['investigation']['mortgage_type'])){
            $mortgage_type=explode(',',$data['investigation']['mortgage_type']);
            foreach ($mortgage_type as $value){
                if($value>0){//显示大于零的索引
                    if($mortgage_type_str) $mortgage_type_str.=',';
                    $mortgage_type_str.=$mortgageType[$value]['name'];
                }
            }
        }
        //获取抵押物类型名称-结束
        ?>
        <td><?php echo $mortgage_type_str;?></td>
    </tr>
    <tr>
        <td class="bg th_width red_font">本金</td>
        <td><?php echo $data['investigation']?Yii::$app->formatter->asDecimal($data['investigation']['principal']):'';?></td>
        <td class="bg th_width red_font">利息</td>
        <td><?php echo $data['investigation']?Yii::$app->formatter->asDecimal($data['investigation']['interest']):'';?></td>
    </tr>
    <tr>
        <td colspan="4"><b>司法进展</b></td>
    </tr>
    <tr>
        <td class="bg">诉讼情况</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['lawsuit']:'';?></td>
    </tr>
    <tr>
        <td class="bg">执行情况</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['execution']:'';?></td>
    </tr>
    <tr>
        <td class="bg">评估、拍卖情况</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['auction']:'';?></td>
    </tr>
    <tr>
        <td colspan="4"><b>本案诉情况</b></td>
    </tr>
    <tr>
        <td class="bg">案卷查询情况</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['records_investigation']:'';?></td>
    </tr>
    <tr>
        <td class="bg">案卷是否一致</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['records_consistence']:'';?></td>
    </tr>
    <tr>
        <td class="bg">调解书/支付令是否送达</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['order_sent']:'';?></td>
    </tr>
    <tr>
        <td class="bg">开庭传票是否送达</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['court_summons']:'';?></td>
    </tr>
    <tr>
        <td class="bg">执行终结方式</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['execution_method']:'';?></td>
    </tr>
    <tr>
        <td class="bg">法官/律师访谈</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['layer_interview']:'';?></td>
    </tr>
    <tr>
        <td colspan="4"><b>未诉时效</b></td>
    </tr>
    <tr>
        <td class="bg">未诉债权催收情况</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['debt_collection']:'';?></td>
    </tr>
    <tr>
        <td class="bg">时效结论</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['prescription']:'';?></td>
    </tr>
    <tr>
        <td class="bg">证据是否有原件</td>
        <td colspan="3"><?php echo $data['investigation']?$data['investigation']['origin_files']:'';?></td>
    </tr>
</table>
<?php
$stakeholder=$data['stakeholder'];//1债务人(借款人就一人)、2抵押人、3保证人、4其他承债人 stakeholder_type
$debtorDetail=array();
$mortgagorDetails=array();
$guarantorDetails=array();
$debtBearingDetails=array();
foreach ($stakeholder as $value){
    $stakeholder_type=$value['stakeholder_type'];
    switch ($stakeholder_type) {
        case 1://debtor
            $debtorDetail = $value;
            break;
        case 2://mortgagor
            $mortgagorDetails[] = $value;
            break;
        case 3://guarantor
            $guarantorDetails[] = $value;
            break;
        case 4://DebtBearing
            $debtBearingDetails[] = $value;
            break;
    }
}
?>
<h4>二、借款人及资产情况</h4>
<table border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;"  width="100%">
    <tr>
        <td class="bg th_width red_font">借款人名称</td>
        <td colspan="2" width="35%"><?php echo $debtorDetail?$debtorDetail['stakeholder_title']:'';?></td>
        <td class="bg th_width">注册资本</td>
        <td colspan="2" width="35%"><?php echo $debtorDetail?$debtorDetail['registered_capital']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">注册地址</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['registered_address']:'';?></td>
        <td class="bg th_width">法定代表人</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['legal_representative']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">经营范围</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['scope_of_business']:'';?></td>
        <td class="bg th_width">股东及持股比例</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['proportion']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width red_font">借款人状况</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['borrower']:'';?></td>
        <td class="bg th_width">和解回购意愿</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['buy_back']:'';?></td>
    </tr>
    <tr>
        <td colspan="6"><b>涉诉情况</b></td>
    </tr>
    <tr>
        <td class="bg">诉讼案号</td>
        <td class="bg">原告/申请执行人</td>
        <td class="bg">被告/被申请执行人</td>
        <td class="bg">涉诉金额</td>
        <td class="bg">法院</td>
        <td class="bg">涉诉内容</td>
    </tr>
    <?php
    if(isset($debtorDetail['investigationLawsuit'])){
        foreach ($debtorDetail['investigationLawsuit'] as $value){
            echo '<tr>
        <td>'.$value['records_number'].'</td>
        <td>'.$value['accuser'].'</td>
        <td>'.$value['defendant'].'</td>
        <td>'.$value['money'].'</td>
        <td>'.$value['court'].'</td>
        <td>'.$value['lawsuit_content'].'</td>
        </tr>';
        }
    }
    ?>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
    </tr>
    <tr>
        <td colspan="6"><b>列失信</b></td>
    </tr>
    <tr>
        <td class="bg th_width">是否列失信</td>
        <td colspan="2"><?php echo $debtorDetail?($debtorDetail['faith']==1?'是':'否'):'';?></td>
        <td class="bg th_width">是否限高</td>
        <td colspan="2"><?php echo $debtorDetail?($debtorDetail['limit_high']==1?'是':'否'):'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">失信名单</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['block_list']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">列失信价值描述</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['block_value']:'';?></td>
    </tr>
    <tr>
        <td colspan="6"><b>变更记录</b></td>
    </tr>
    <tr>
        <td colspan="6"><?php echo $debtorDetail?$debtorDetail['update_log']:'';?></td>
    </tr>
    <tr>
        <td colspan="6"><b>抵押物外其他承债资产</b></td>
    </tr>
    <tr>
        <td colspan="6"><?php echo $debtorDetail?$debtorDetail['other_guarantee']:'';?></td>
    </tr>
    <tr>
        <td colspan="6"><b>查封顺序及其他抵押、查封详情</b></td>
    </tr>
    <tr>
        <td colspan="6">
            <?php
                echo $debtorDetail?$debtorDetail['seal_order']:'';
                echo '<br/>';
                echo $debtorDetail?$debtorDetail['other_mortgage']:'';
            ?>
        </td>
    </tr>
    <tr>
        <td class="bg th_width">法院评估价</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['evaluate_price']:'';?></td>
        <td class="bg th_width">法院拍卖价</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['auction_price']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">市场询价</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['market_price']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">同类型司法拍卖资产价格</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['identical_price']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">访谈中介最近成交及快速转让价</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['recently_price']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">买家报价</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['buyer_price']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">租金情况及其他可比物业</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['rental_price']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">税费</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['tax_price']:'';?></td>
    </tr>
    <tr>
        <td colspan="6"><b>现场状态</b></td>
    </tr>
    <tr>
        <td class="bg th_width">租赁</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['rent']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">居住</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['live']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">现场访谈及其他情况</td>
        <td colspan="5"><?php echo $debtorDetail?$debtorDetail['interview']:'';?></td>
    </tr>
    <tr>
        <td colspan="6"><b>回现评估</b></td>
    </tr>
    <tr>
        <td class="bg th_width">回现保守</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['payment_reservation']:'';?></td>
        <td class="bg th_width">回现激进</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['payment_radical']:'';?></td>
    </tr>
    <tr>
        <td class="bg th_width">保守依据</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['reservation_evidence']:'';?></td>
        <td class="bg th_width">激进依据</td>
        <td colspan="2"><?php echo $debtorDetail?$debtorDetail['radical_evidence']:'';?></td>
    </tr>
</table>
<h4>三、抵押人及抵押物情况</h4>
<?php
    if(count($mortgagorDetails)>0){
        foreach($mortgagorDetails as $key=>$mortgagorDetail){
?>
            <h5>抵押人<?php echo $chineseNumber[$key];?></h5>
            <table  border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;"  width="100%">
                <tr>
                    <td class="bg th_width red_font">抵押人名称</td>
                    <td colspan="2" width="35%"><?php echo $mortgagorDetail?$mortgagorDetail['stakeholder_title']:'';?></td>
                    <td class="bg th_width">注册资本</td>
                    <td colspan="2" width="35%"><?php echo $mortgagorDetail?$mortgagorDetail['registered_capital']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">注册地址</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['registered_address']:'';?></td>
                    <td class="bg th_width">法定代表人</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['legal_representative']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">经营范围</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['scope_of_business']:'';?></td>
                    <td class="bg th_width">股东及持股比例</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['proportion']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width red_font">抵押人状况</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['borrower']:'';?></td>
                    <td class="bg th_width">和解回购意愿</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['buy_back']:'';?></td>
                </tr>
                <tr>
                    <td colspan="6"><b>涉诉情况</b></td>
                </tr>
                <tr>
                    <td class="bg">诉讼案号</td>
                    <td class="bg">原告/申请执行人</td>
                    <td class="bg">被告/被申请执行人</td>
                    <td class="bg">涉诉金额</td>
                    <td class="bg" >法院</td>
                    <td class="bg">涉诉内容</td>
                </tr>
                <?php
                if(isset($mortgagorDetail['investigationLawsuit'])){
                    foreach ($mortgagorDetail['investigationLawsuit'] as $value){
                        echo '<tr>
        <td>'.$value['records_number'].'</td>
        <td>'.$value['accuser'].'</td>
        <td>'.$value['defendant'].'</td>
        <td>'.$value['money'].'</td>
        <td>'.$value['court'].'</td>
        <td>'.$value['lawsuit_content'].'</td>
        </tr>';
                    }
                }
                ?>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="6"><b>列失信</b></td>
                </tr>
                <tr>
                    <td class="bg th_width">是否列失信</td>
                    <td colspan="2"><?php echo $mortgagorDetail?($mortgagorDetail['faith']==1?'是':'否'):'';?></td>
                    <td class="bg th_width">是否限高</td>
                    <td colspan="2"><?php echo $mortgagorDetail?($mortgagorDetail['limit_high']==1?'是':'否'):'';?></td></td>
                </tr>
                <tr>
                    <td class="bg th_width">失信名单</td>
                    <td colspan="5"><?php echo $mortgagorDetail?$mortgagorDetail['block_list']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">列失信价值描述</td>
                    <td colspan="5"><?php echo $mortgagorDetail?$mortgagorDetail['block_value']:'';?></td>
                </tr>
                <tr>
                    <td colspan="6"><b>抵押详情</b></td>
                </tr>
                <tr>
                    <td class="bg th_width">抵押物担保范围</td>
                    <td colspan="5"><?php echo $mortgagorDetail?$mortgagorDetail['guarantee_scope']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">抵押物详细情况</td>
                    <td colspan="5"><?php echo $mortgagorDetail?$mortgagorDetail['guarantee']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">抵押顺序</td>
                    <td colspan="5"><?php echo $mortgagorDetail?$mortgagorDetail['mortgage_order']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">查封顺序</td>
                    <td colspan="5"><?php echo $mortgagorDetail?$mortgagorDetail['seal_order']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">评估价</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['evaluate_price']:'';?></td>
                    <td class="bg th_width">拍卖价</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['auction_price']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">市场询价</td>
                    <td colspan="5"><?php echo $mortgagorDetail?$mortgagorDetail['market_price']:'';?></td>
                </tr>
                <tr>
                    <td colspan="6"><b>现场状态</b></td>
                </tr>
                <tr>
                    <td class="bg th_width">租赁</td>
                    <td colspan="5"><?php echo $mortgagorDetail?$mortgagorDetail['rent']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">居住</td>
                    <td colspan="5"><?php echo $mortgagorDetail?$mortgagorDetail['live']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">现场访谈及其他情况</td>
                    <td colspan="5"><?php echo $mortgagorDetail?$mortgagorDetail['interview']:'';?></td>
                </tr>
                <tr>
                    <td colspan="6"><b>回现评估</b></td>
                </tr>
                <tr>
                    <td class="bg th_width">回现保守</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['payment_reservation']:'';?></td>
                    <td class="bg th_width">回现激进</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['payment_radical']:'';?></td>
                </tr>
                <tr>
                    <td class="bg th_width">保守依据</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['reservation_evidence']:'';?></td>
                    <td class="bg th_width">激进依据</td>
                    <td colspan="2"><?php echo $mortgagorDetail?$mortgagorDetail['radical_evidence']:'';?></td>
                </tr>
            </table>
<?php
        }
    }
?>

<h4>四、保证人及资产情况</h4>
<?php
if(count($guarantorDetails)>0){
    foreach ($guarantorDetails as $key=>$guarantorDetail){
?>
        <h5>保证人<?php echo $chineseNumber[$key];?></h5>
        <table  border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;"  width="100%">
            <tr>
                <td class="bg th_width red_font">保证人名称</td>
                <td colspan="2" width="35%"><?php echo $guarantorDetail?$guarantorDetail['stakeholder_title']:'';?></td>
                <td class="bg th_width">注册资本</td>
                <td colspan="2" width="35%"><?php echo $guarantorDetail?$guarantorDetail['registered_capital']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">注册地址</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['registered_address']:'';?></td>
                <td class="bg th_width">法定代表人</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['legal_representative']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">经营范围</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['scope_of_business']:'';?></td>
                <td class="bg th_width">股东及持股比例</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['proportion']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width red_font">保证人状况</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['borrower']:'';?></td>
                <td class="bg th_width">和解回购意愿</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['buy_back']:'';?></td>
            </tr>
            <tr>
                <td colspan="6"><b>涉诉情况</b></td>
            </tr>
            <tr>
                <td class="bg">诉讼案号</td>
                <td class="bg">原告/申请执行人</td>
                <td class="bg">被告/被申请执行人</td>
                <td class="bg">涉诉金额</td>
                <td class="bg">法院</td>
                <td class="bg">涉诉内容</td>
            </tr>
            <?php
            if(isset($guarantorDetail['investigationLawsuit'])){
                foreach ($guarantorDetail['investigationLawsuit'] as $value){
                    echo '<tr>
        <td>'.$value['records_number'].'</td>
        <td>'.$value['accuser'].'</td>
        <td>'.$value['defendant'].'</td>
        <td>'.$value['money'].'</td>
        <td>'.$value['court'].'</td>
        <td>'.$value['lawsuit_content'].'</td>
        </tr>';
                }
            }
            ?>
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td colspan="6"><b>列失信</b></td>
            </tr>
            <tr>
                <td class="bg th_width">是否列失信</td>
                <td colspan="2"><?php echo $guarantorDetail?($guarantorDetail['faith']==1?'是':'否'):'';?></td>
                <td class="bg th_width">是否限高</td>
                <td colspan="2"><?php echo $guarantorDetail?($guarantorDetail['limit_high']==1?'是':'否'):'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">失信名单</td>
                <td colspan="5"><?php echo $guarantorDetail?$guarantorDetail['block_list']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">列失信价值描述</td>
                <td colspan="5"><?php echo $guarantorDetail?$guarantorDetail['block_value']:'';?></td>
            </tr>
            <tr>
                <td colspan="6"><b>担保详情</b></td>
            </tr>
            <tr>
                <td class="bg th_width">保证人保证范围</td>
                <td colspan="5"><?php echo $guarantorDetail?$guarantorDetail['guarantee_scope']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">承债资产详细情况</td>
                <td colspan="5"><?php echo $guarantorDetail?$guarantorDetail['guarantee']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">查封顺序</td>
                <td colspan="5"><?php echo $guarantorDetail?$guarantorDetail['seal_order']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">其他抵押、查封详情</td>
                <td colspan="5"><?php echo $guarantorDetail?$guarantorDetail['other_mortgage']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">评估价</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['evaluate_price']:'';?></td>
                <td class="bg th_width">拍卖价</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['auction_price']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">市场询价</td>
                <td colspan="5"><?php echo $guarantorDetail?$guarantorDetail['market_price']:'';?></td>
            </tr>
            <tr>
                <td colspan="6"><b>现场状态</b></td>
            </tr>
            <tr>
                <td class="bg th_width">租赁</td>
                <td colspan="5"><?php echo $guarantorDetail?$guarantorDetail['rent']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">居住</td>
                <td colspan="5"><?php echo $guarantorDetail?$guarantorDetail['live']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">现场访谈及其他情况</td>
                <td colspan="5"><?php echo $guarantorDetail?$guarantorDetail['interview']:'';?></td>
            </tr>
            <tr>
                <td colspan="6"><b>回现评估</b></td>
            </tr>
            <tr>
                <td class="bg th_width">回现保守</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['payment_reservation']:'';?></td>
                <td class="bg th_width">回现激进</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['payment_radical']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">保守依据</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['reservation_evidence']:'';?></td>
                <td class="bg th_width">激进依据</td>
                <td colspan="2"><?php echo $guarantorDetail?$guarantorDetail['radical_evidence']:'';?></td>
            </tr>
        </table>
<?php
    }
}
?>

<h4>五、其他承债人及资产情况</h4>
<?php
if(count($debtBearingDetails)>0){
    foreach ($debtBearingDetails as $key=>$debtBearingDetail){
?>
        <h5>承债人<?php echo $chineseNumber[$key];?></h5>
        <table  border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;"  width="100%">
            <tr>
                <td class="bg th_width red_font">承债人名称</td>
                <td colspan="2" width="35%"><?php echo $debtBearingDetail?$debtBearingDetail['stakeholder_title']:'';?></td>
                <td class="bg th_width">注册资本</td>
                <td colspan="2" width="35%"><?php echo $debtBearingDetail?$debtBearingDetail['registered_capital']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">注册地址</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['registered_address']:'';?></td>
                <td class="bg th_width">法定代表人</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['legal_representative']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">经营范围</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['scope_of_business']:'';?></td>
                <td class="bg th_width">股东及持股比例</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['proportion']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width red_font">承债人状况</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['borrower']:'';?></td>
                <td class="bg th_width">和解回购意愿</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['buy_back']:'';?></td>
            </tr>
            <tr>
                <td colspan="6"><b>涉诉情况</b></td>
            </tr>
            <tr>
                <td class="bg">诉讼案号</td>
                <td class="bg">原告/申请执行人</td>
                <td class="bg">被告/被申请执行人</td>
                <td class="bg">涉诉金额</td>
                <td class="bg">法院</td>
                <td class="bg">涉诉内容</td>
            </tr>
            <?php
            if(isset($debtBearingDetail['investigationLawsuit'])){
                foreach ($debtBearingDetail['investigationLawsuit'] as $value){
                    echo '<tr>
        <td>'.$value['records_number'].'</td>
        <td>'.$value['accuser'].'</td>
        <td>'.$value['defendant'].'</td>
        <td>'.$value['money'].'</td>
        <td>'.$value['court'].'</td>
        <td>'.$value['lawsuit_content'].'</td>
        </tr>';
                }
            }
            ?>
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td colspan="6"><b>列失信</b></td>
            </tr>
            <tr>
                <td class="bg th_width">是否列失信</td>
                <td colspan="2"><?php echo $debtBearingDetail?($debtBearingDetail['faith']==1?'是':'否'):'';?></td>
                <td class="bg th_width">是否限高</td>
                <td colspan="2"><?php echo $debtBearingDetail?($debtBearingDetail['limit_high']==1?'是':'否'):'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">失信名单</td>
                <td colspan="5"><?php echo $debtBearingDetail?$debtBearingDetail['block_list']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">列失信价值描述</td>
                <td colspan="5"><?php echo $debtBearingDetail?$debtBearingDetail['block_value']:'';?></td>
            </tr>
            <tr>
                <td colspan="6"><b>承债详情</b></td>
            </tr>
            <tr>
                <td class="bg th_width">承债理由及法律依据</td>
                <td colspan="5"><?php echo $debtBearingDetail?$debtBearingDetail['guarantee_scope']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">承债资产详细情况</td>
                <td colspan="5"><?php echo $debtBearingDetail?$debtBearingDetail['guarantee']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">查封顺序</td>
                <td colspan="5"><?php echo $debtBearingDetail?$debtBearingDetail['seal_order']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">其他抵押、查封详情</td>
                <td colspan="5"><?php echo $debtBearingDetail?$debtBearingDetail['other_mortgage']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">评估价</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['evaluate_price']:'';?></td>
                <td class="bg th_width">拍卖价</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['auction_price']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">市场询价</td>
                <td colspan="5"><?php echo $debtBearingDetail?$debtBearingDetail['market_price']:'';?></td>
            </tr>
            <tr>
                <td colspan="6"><b>现场状态</b></td>
            </tr>
            <tr>
                <td class="bg th_width">租赁</td>
                <td colspan="5"><?php echo $debtBearingDetail?$debtBearingDetail['rent']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">居住</td>
                <td colspan="5"><?php echo $debtBearingDetail?$debtBearingDetail['live']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">现场访谈及其他情况</td>
                <td colspan="5"><?php echo $debtBearingDetail?$debtBearingDetail['interview']:'';?></td>
            </tr>
            <tr>
                <td colspan="6"><b>回现评估</b></td>
            </tr>
            <tr>
                <td class="bg th_width">回现保守</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['payment_reservation']:'';?></td>
                <td class="bg th_width">回现激进</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['payment_radical']:'';?></td>
            </tr>
            <tr>
                <td class="bg th_width">保守依据</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['reservation_evidence']:'';?></td>
                <td class="bg th_width">激进依据</td>
                <td colspan="2"><?php echo $debtBearingDetail?$debtBearingDetail['radical_evidence']:'';?></td>
            </tr>
        </table>
<?php
    }
}
?>

<h4>六、尽调评估总结</h4>
<table  border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;"  width="100%">
    <tr>
        <td class="bg" colspan="2" style="text-align: center;"><b>尽调评估总结</b></td>
    </tr>
    <tr>
        <td class="bg th_width" style="text-align: center;min-height: 60px;"><b>结论</b></td><td width="80%"><?php echo $data['investigation']?$data['investigation']['conclusion']:'';?></td>
    </tr>
<!--    <tr>-->
<!--        <td height="60">--><?php //echo $data['investigation']?$data['investigation']['conclusion']:'';?><!--</td>-->
<!--    </tr>-->
</table>
<?php
$debtFiles=array();//承债证据
$assetFiless=array();//资产查询
$sceneFiless=array();//现场照
foreach ($data['investigationFile'] as $val){
    switch ($val['category']) {
        case 1://现场照
            $sceneFiless[]= $val;
            break;
        case 2://承债证据
            $debtFiles[]= $val;
            break;
        case 3://资产查询证据
            $assetFiless[]= $val;
            break;
    }
}

?>
<h4>七、承债证据</h4>
<?php
    foreach ($debtFiles as $val){
        $urlFile=Url::to('@web/uploads/investigation-file/'.$val['file_name'], true);
        echo '<img style="" src="'.$urlFile.'">';
    }
?>
<h4>八、资产查询证据</h4>
<?php
foreach ($assetFiless as $val){
    $urlFile=Url::to('@web/uploads/investigation-file/'.$val['file_name'], true);
    echo '<img src="'.$urlFile.'">';
}
?>
<h4>九、现场照</h4>
<?php
foreach ($sceneFiless as $val){
    $urlFile=Url::to('@web/uploads/investigation-file/'.$val['file_name'], true);
    echo '<img src="'.$urlFile.'">';
}
?>
</body>
</html>
<?php
ob_start(); //打开缓冲区
header("Cache-Control: public");
header("Content-type: application/octet-stream");
header("Accept-Ranges: bytes");
$fileName=$data['title'].'_尽调评估报告'.date("Ymd");//His
if (strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE')) {
    header('Content-Disposition: attachment; filename='.$fileName.'.doc');
} else if (strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox')) {
    Header('Content-Disposition: attachment; filename='.$fileName.'.doc');
} else {
    header('Content-Disposition: attachment; filename='.$fileName.'.doc');
}
header("Pragma:no-cache");
header("Expires:0");
ob_end_flush();//输出全部内容到浏览器
?>

